#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

struct node {
	int key;
	int value;
	struct node*  next;
};

struct node*  head = NULL;

struct node* find(int key) {
	
	struct node* current = head;
	if(current == NULL) {
		return NULL;
	}
	for(  ;current->key != key;   ) {
		current = current->next;
		if(current == NULL) {
			return NULL;
		}
	}
	return current;
}

int insert(int key, int value){
	struct node*  np = (struct node*)malloc(sizeof(struct node));
	
	//TODO 是否有重复 Key 
	np->value = value;
	np->key = key;
	np->next = head;
	head = np;
	
	return 0;
}


int main(int argc, char *argv[]) {
	
	insert(1, 2);
	insert(2, 10);
	insert(3, 20);
	printf("%d",  find(2)->value);
	return 0;
}
